import static org.junit.Assert.*;

import org.junit.Test;

public class CommonTest {

	@Test
	public final void testPrintList() {
		fail("Not yet implemented");
	}

	@Test
	public final void testPrintArrayTArray() {
		fail("Not yet implemented");
	}

	@Test
	public final void testPrintArrayIntArrayString() {
		fail("Not yet implemented");
	}

	@Test
	public final void testWriteList() {
		fail("Not yet implemented");
	}

	@Test
	public final void testWriteArrayTArrayFile() {
		fail("Not yet implemented");
	}

	@Test
	public final void testWriteArrayIntArrayFile() {
		fail("Not yet implemented");
	}

	@Test
	public final void testReadFile() {
		fail("Not yet implemented");
	}

	@Test
	public final void testPrimeFactor() {
		final long start = System.currentTimeMillis();
		assertArrayEquals(new int[] { 2 }, Common.primeFactor(2));
		assertArrayEquals(new int[] { 7 }, Common.primeFactor(7));
		assertArrayEquals(new int[] { 2, 2, 2, 2 }, Common.primeFactor(16));
		assertArrayEquals(new int[] { 3, 7 }, Common.primeFactor(21));
		assertArrayEquals(new int[] { 3559 }, Common.primeFactor(3559));
		assertNotEquals(3, Common.primeFactor(156487876));
		System.out.println("End after : " + (System.currentTimeMillis() - start));
	}

	@Test
	public final void testIsPrime() {
		assertFalse(Common.isPrime(1));
		assertTrue(Common.isPrime(2));
		assertTrue(Common.isPrime(5));
		assertTrue(Common.isPrime(997));
		assertFalse(Common.isPrime(49));
		assertTrue(Common.isPrime(27644437));
	}

	@Test
	public final void testGcd() {
		assertEquals(1, Common.gcd(2, 3));
		assertEquals(5, Common.gcd(5, 15));
		assertEquals(5, Common.gcd(15, 5));
		assertEquals(1, Common.gcd(2, 497));
		assertEquals(12, Common.gcd(36, 24));
	}

	@Test
	public final void testNumberLength() {
		assertEquals(1, Common.numberLength(1));
		assertEquals(2, Common.numberLength(12));
		assertEquals(3, Common.numberLength(123));
	}

	@Test
	public final void testPower10() {
		assertEquals(100, Common.power10(2));
		assertEquals(1000, Common.power10(3));
	}
}
